package com.css.entity;

import java.util.*;

/**
 * <p>
 * -
 * </p>
 *
 * @author css
 * @since 2019/1/11
 */
public class NeedUploadMap {
    private final static HashMap<String, Integer> map = new HashMap<>();
    private final static Set<Map.Entry<String, Integer>> entries = new HashSet<>();

    public static void addNum(String key) {
        Integer integer = map.get(key);
        System.out.println(key);
        if (integer == null) {
            map.put(key, 1);
        } else {
            map.put(key, integer + 1);
        }
    }


    public static Integer get(String key) {
        return map.get(key);
    }

    public static Set<Map.Entry<String, Integer>> getKeyList() {
        entries.addAll(map.entrySet());
        map.clear();
        return entries;
    }

    public static void rollBack(List<KeyBorder> data) {
        for (KeyBorder datum : data) {
            map.merge(datum.getKeyName(), datum.getPressNum(), (a, b) -> a + b);

        }
    }
}
